Help:Magic words
From PyroGuide
This is an organised index of Magic words used in MediaWiki. Tags such as "[MW1.5+]" indicate the version that first supported the magic word. "XYZ" indicates user input, which is used in the example.
Contents |
[edit] Table of contents
Word | Explanation |
---|---|
__NOTOC__ | Hides ToC on the current page. |
__FORCETOC__ | Forces the table of contents to appear. |
__TOC__ | Places a ToC here (see also compact TOC). |
[edit] More magic
Word | Explanation |
---|---|
__NOEDITSECTION__ | Hides the edit links beside headings. |
__NOCONTENTCONVERT__ __NOCC__ | Don't perform the content language conversion (character and phase) in article display; for example, Chinese zh with zh_cn, zh_tw, zh_sg, zh_hk. |
__NOTITLECONVERT__ __NOTC__ | Like __NOCC__ but affecting article title only. |
__END__ | Allows for trailing whitespace to be included in the page save. |
__START__ | This magic word has no effect but an ID in MagicWord.php (MAG_START ).
|
[edit] Template modifiers
Word | Usage | Explanation |
---|---|---|
{{subst:}} | {{subst:XYZ}} | Substitutes the template call with the content of the template. |
{{msg:}} | {{msg:XYZ}} | If a template clashes with a magic word, use of the msg: modifier will use the template instead of the magic word. Otherwise, the magic word is used. |
{{msgnw:}} | {{msgnw:XYZ}} | The template message is pasted as unevaluated <nowiki> text. |
{{INT:}} | {{INT:XYZ}} | If a template clashes with a MediaWiki:message, use of the INT: modifier will use the message instead of the template. Otherwise, the template is used. |
{{raw:}} | {{raw:XYZ}} | Like {{msg:}} Template:Unclear
|
[edit] Time
Word | Example | Explanation |
---|---|---|
{{CURRENTDAY}} | 8
| Displays the current day in numeric form. |
{{CURRENTDAY2}} | 08
| Displays the current day in numeric form (and with a leading zero if less than 10). |
{{CURRENTDAYNAME}} | Friday
| Displays the current day in named form. |
{{CURRENTDOW}} | 5
| Displays the current day as a number of the week (0=Sunday, 1=Monday...). |
{{CURRENTMONTH}} | 06
| Displays the current month in numeric form. |
{{CURRENTMONTHABBREV}} | Jun
| [MW1.5+] Displays the abbreviation of the current month. |
{{CURRENTMONTHNAME}} | June
| Displays the current month in named form. |
{{CURRENTMONTHNAMEGEN}} | June
| Displays the name of the current month in genitive form. Wikis that don't support this will default to {{CURRENTMONTHNAME}}. |
{{CURRENTTIME}} | 22:07
| Displays the current time of day (hours:minutes). |
{{CURRENTWEEK}} | 23
| Displays the number of the current week (1-52). |
{{CURRENTYEAR}} | 2012
| Returns the current year. |
[edit] Formatting
Word | Example | Explanation |
---|---|---|
{{LC:}} | {{LC:AbC dEf}} = abc def
| [MW1.5+] LowerCase |
{{UC:}} | {{UC:aBc DeF}} = ABC DEF
| [MW1.5+] UpperCase |
{{LCFIRST:}} | {{LCFIRST:Ab Cd}} = ab Cd
| [MW1.5+] LC first character |
{{UCFIRST:}} | {{UCFIRST:aB cD}} = AB cd
| [MW1.5+] UC first character |
[edit] Page names, locations, and URLs
Word | Example | Explanation |
---|---|---|
{{PAGENAME}} | Magic words
| Returns the name of the current page, including all levels (Title/Subtitle/Sub-subtitle). |
{{PAGENAMEE}} | Magic_words
| More URL-friendly percent encoded special characters (rarely necessary). |
{{SUBPAGENAME}} {{SUBPAGENAMEE}} | Magic words
| [MW1.5+] Returns the name of the current page, excluding parent pages ("Title/Subtitle" becomes "Subtitle"). |
{{NAMESPACE}} {{NAMESPACEE}} | Help
| Returns the name of the namespace the current page resides in. |
{{FULLPAGENAME}} {{FULLPAGENAMEE}} | Help:Magic words
| {{NAMESPACE}}:{{PAGENAME}} or {{NAMESPACEE}}:{{PAGENAMEE}} |
{{REVISIONID}} | 1777
| [MW1.5+] Gives you the unique identifying number of the article or diff database. |
{{SITENAME}} | PyroGuide
| Returns the name of the wiki (set in LocalSettings.php). |
{{NS:}} | {{NS:4}} = PyroGuide {{NS:PROJECT}} = PyroGuide
| Returns the name of a given namespace number. |
{{LOCALURL:x y}} {{LOCALURLE:%}} | /index.php?title=X_y
| Returns the local URL of a given page. The page might not exist. |
{{SERVER}} | http://pyroguide.com | Returns the domain and subdomain URL of the wiki. In conjunction with {{localurl:}} obsolete, use {{fullurl:}} |
{{FULLURL:x y}} {{FULLURLE:x y}} | http://pyroguide.com/index.php?title=X_y http://pyroguide.com/index.php?title=X_y | [MW1.5+] Returns the full URL of a given page. |
{{SCRIPTPATH}} |
| [MW1.5+] Returns the value of $wgScriptPath in LocalSettings.php. |
{{SERVERNAME}} | pyroguide.com
| [MW1.5+] Returns the value of $wgServerName in LocalSettings.php. |
[edit] Image Modifiers
These are image modifiers used in [[Image:title.ext|modifier|...|modifier]]
links. Some are mutually exclusive, and then the last specified wins.
[edit] Size
The last unrecognized modifier is used as caption for framed images or together with thumbnails. It's also used as description alt=text.
Word | Usage | Explanation |
---|---|---|
framed | [[Image:Mediawiki.png|framed]] | Places an image in a frame with a description. Can also be spelled enframed or frame. Uses original size. |
thumbnail | [[Image:Mediawiki.png|thumbnail]] | Modifies image size, sets it to dependant on user's favourite thumbnail size in their preferences. Can also be used as thumb. |
thumb=xyz | [[Image:Mediawiki.png|thumb=0]] | Manualthumb Template:Unclear |
width px | [[Image:Mediawiki.png|40px]] | Scales image to given width in pixels |
[edit] Position
The positions are mutually exclusive, the last specified wins. Template:clr can stop floating. For inline images only modifier px (see above) is supported.
Word | Usage | Explanation |
---|---|---|
right | [[Image:Mediawiki.png|right]] | Modifies position, floats the image to the right. |
left | [[Image:Mediawiki.png|left]] | Modifies position, floats the image to the left. |
none | [[Image:Mediawiki.png|none]] | Modifies position, explicitly states image should not float. |
center | [[Image:Mediawiki.png|center]] | Like none but centered. Can also be spelled centre. |
[edit] Miscellany
Word | Usage | Explanation |
---|---|---|
{{NUMBEROFARTICLES}} | 539
| A variable which returns the total number of articles on the Wiki. |
{{NUMBEROFFILES}} | 714
| [MW1.5+] Returns the number of uploaded files (rows in the image table). |
{{grammar:case | word }} | In Czech language, {{grammar:1sg|Wikipedie}} outputs Wikipedie , while {{grammar:7sg|Wikipedie}} outputs Wikipedií .
| Returns derived word forms in inflected languages. Cases in which this could be used depend on the specific language. |
{{plural:count |form1 | form2 }} {{plural:count |1st | 2nd | 3rd }} | {{plural:2 | is | are }} outputs are {{plural:0 | word | words}} outputs words
| Plural transformations needed for languages like Russian and Polish depending on "count mod 10". See w:Plural, or for an example LanguageRu.php. |
#redirect | #REDIRECT [[target]] at top of source page | Creates a redirect to another page. |